package basic;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.batik.dom.util.HashTable;

public class JavaCollenctionAndMap {

	public static void main(String[] args) {
		int[] ints=new int[100];
		int intLength=ints.length;
		ArrayList<Integer> al=new ArrayList<Integer>(100);//10
		
		al.add(1);
		al.add(3);
		al.add(2);
		Collections.sort(al);
		for (Integer i : al) {
			System.out.println(i);
		}
		List<String> ll=new LinkedList<String>();
		
		Set<String> sh=new HashSet<String>();
		Set<String> shl=new LinkedHashSet<String>();
		Set<String> st=new TreeSet<String>();
		
		Map<String,String> mh=new HashMap<String,String>();
		Map<String,String> mlh=new LinkedHashMap<String,String>();
		TreeMap<Integer,String> mt=new TreeMap<Integer,String>();
		mt.put(3,"1");
		mt.put(2,"1");
		mt.put(1,"1");
		//map的四种遍历方式
		for (Map.Entry<Integer, String> e:mt.entrySet()){
			System.out.println(e.getKey());
		}
		for (Integer key:mt.keySet()) {
			System.out.println(key);
		}
		for (String value:mt.values()) {
			System.out.println(value);
		}
		Iterator<Entry<Integer, String>> maps=mt.entrySet().iterator();
		
		while (maps.hasNext()) {
			System.out.println(maps.next().getValue());
		}
		System.out.println();
		HashTable tt=new HashTable();
	    tt.put("0", "abc");
		ConcurrentHashMap<String,String> chm=new ConcurrentHashMap<String,String>();
		chm.put("0","abc");
		
		mt.comparator();//自然排序
		mt.put(5,"1");
		Collections.sort(al);
		Arrays.sort(ints);
		System.out.println(1 > 2 ? 1:2);
	}

}
